package com.huawei.crm.web.controller;

import com.huawei.crm.service.IEmployeeService;
import com.huawei.crm.util.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 批量操作控制层
 *
 * @author 罗华
 * @date 2021/11/24
 */
@RestController
@RequestMapping("/batch")
@Slf4j
public class BatchController extends BaseController {


    @Autowired
    private IEmployeeService employeeService;


    @RequestMapping("/save")
    private JsonResult testBatchSave() {

        long s1 = System.currentTimeMillis();
        JsonResult result = new JsonResult();
        employeeService.batchSave();
        long s2 = System.currentTimeMillis();
        long l = s2 - s1;
        result.setErrorMsg(String.valueOf(l));
        return result;
    }


    @RequestMapping("/forSave")
    private JsonResult testForSave() {

        long s1 = System.currentTimeMillis();
        JsonResult result = new JsonResult();
        employeeService.forSave();
        long s2 = System.currentTimeMillis();
        long l = s2 - s1;
        result.setErrorMsg(String.valueOf(l));
        return result;
    }

}
